package com.xiaoha.pogy.controllers;

import com.xiaoha.pogy.dao.BorrowRepository;
import com.xiaoha.pogy.entities.Borrow;
import com.xiaoha.pogy.services.BorrowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.persistence.Entity;
import java.util.List;

@Controller
@RequestMapping("givebacks")
public class GivebackController {

    @Autowired
    BorrowService borrowService;


    @GetMapping
    public String displayStudentForm(Model model) {

        List<Borrow> borrows = borrowService.getAll();
        model.addAttribute("borrows",borrows);
        return "givebacks/list-givebacks";
    }
}
